package com.ruoyi.web.controller.vip;

import com.alibaba.fastjson2.JSON;
import com.nygym.domain.VipMember;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.cache.CacheProperties.Caffeine;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author XJK
 * @create_time 2025/3/6
 */
@RestController
@RequestMapping("/vip/member")
@Slf4j
public class VipMemberController extends BaseController {



    // todo: 处理get请求 /list?pageNum=1&pageSize=10
    @GetMapping("/list")
    public TableDataInfo queryVipMemberList(@RequestParam("pageNum") int pageNum, @RequestParam("pageSize") int pageSize) {

        List<VipMember> vipMemberList = new ArrayList<>();

        VipMember vipMember = new VipMember();
        vipMember.setId(1L);
        vipMember.setName("张三");
        vipMember.setSex("男");
        vipMemberList.add(vipMember);

        return getDataTable(vipMemberList);
    }

    @PostMapping("/add")
    public AjaxResult addVipMember(@RequestBody VipMember vipMember){
        log.info("新增会员信息：{}", JSON.toJSONString(vipMember));
        Caffeine caffeine = new Caffeine();
        return success();
    }

}
